//
//  RecommendCell.m
//  婚礼纪  首页
//
//  Created by 太阳 on 15/5/15.
//  Copyright (c) 2015年 三人. All rights reserved.
//

#import "RecommendCell.h"
#import "RecommendModel.h"
#import "UIImageView+WebCache.h"
@implementation RecommendCell

- (void)awakeFromNib {
    
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 280)];
        [view setBackgroundColor:[UIColor whiteColor]];

        self.myImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 210)];
//        [self.myImageView setBackgroundColor:[UIColor yellowColor]];
        
        self.title = [[UILabel alloc]initWithFrame:CGRectMake(10, 220, [UIScreen mainScreen].bounds.size.width - 70, 30)];
//        [self.title setBackgroundColor:[UIColor greenColor]];
        [view addSubview:self.title];
//        self.title.text = @"弟弟弟弟积极偶就hi1";
        self.title.textColor = [UIColor colorWithRed:0.4 green:0.4 blue:0.4 alpha:1];
        self.title.font = [UIFont systemFontOfSize:20];
        self.name = [[UILabel alloc]initWithFrame:CGRectMake(10, 250, [UIScreen mainScreen].bounds.size.width - 20, 20)];
//        [self.name setBackgroundColor:[UIColor blueColor]];
//        self.name.font = [UIFont systemFontOfSize:12];
        self.name.textColor = [UIColor colorWithRed:0.55 green:0.55 blue:0.55 alpha:0.7];
//        self.name.text = @"你的破招太多";
        
        self.collectors_count = [[UILabel alloc]initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 60 , 220, 50, 30)];
//        self.collectors_count.text = @"☆wode1";
        self.collectors_count.font = [UIFont systemFontOfSize:18];
        self.collectors_count.textColor = [UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:0.6];
//        [self.collectors_count setBackgroundColor:[UIColor orangeColor]];
        [view addSubview:self.collectors_count];
        self.selectionStyle = UITableViewCellAccessoryNone;
        [view addSubview:self.name];
        [self.contentView addSubview:view];
        [self.contentView setBackgroundColor:[UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:0.8]];
        [self.contentView addSubview:self.myImageView];
        
    }
    return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    //拖动就会走
}
- (void)cellBuildingWithModel:(RecommendModel *)model
{
    [self.myImageView sd_setImageWithURL:[NSURL URLWithString:model.cover_path] placeholderImage:nil options:SDWebImageRetryFailed];
    NSString *coll = [NSString stringWithFormat:@"☆%@", model.collectors_count];
    self.collectors_count.text = coll;
    self.title.text = model.title;
    self.name.text = model.name;
}
@end
